<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父子组件</title>
</head>
<body>
    <script src='/js/vue.js'></script>
    <div id='app'>

        <p>{{msg}}</p>
    </div>
    <script>

        //创建子组件构造器
        const cpnsonConstructor = Vue.extend({
            
            template:`
                <div>
                    <h2>这是组件的标题</h2>
                    <p>这是组件中的内容</p>
                    <button>这是组件的按钮</button>
                </div>
            `,
            //组件内注册
            components:{
                //组件内注册(全局注册，局部注册，组件内注册)


                'cpn-son':cpnsonConstrud=ctor
            }
        })


        //创建父组件构造器
        const cpnConstructor = Vue.extend({
            
            template:`
                <div>
                    <h2>这是组件的标题</h2>
                    <p>这是组件中的内容</p>
                    <button>这是组件的按钮</button>
                </div>
            `,
           
        })

        
        Vue.component(''/*组件的*/,cpnConstructor/**/)

        let app = new Vue({
            el:'#app',
            data:{
                msg:'hello word'
            }
        })
    </script>
</body>
</html>